package com.zlf.sb.demo.design.single;

/***
 *@title SimpleSingleton4
 *@description <TODO description class purpose>
 *@author wgc_j
 *@version 1.0.0
 *@create 2025-02-20 13:36
 **/
public class SimpleSingleton4 {
    public volatile static SimpleSingleton4 instance  ;
     public SimpleSingleton4(){

     }
      public static SimpleSingleton4 getInstance(){
         if (instance==null){
             synchronized (SimpleSingleton4.class){
                 if (instance==null){
                     instance=new SimpleSingleton4();
                 }
             }
         }
         return instance;
      }

    public static void main(String[] args) {
        SimpleSingleton4 simpleSingleton4=SimpleSingleton4.getInstance();
        SimpleSingleton4 simpleSingleton41=SimpleSingleton4.getInstance();
        System.out.println(simpleSingleton4==simpleSingleton41);
        System.out.println(simpleSingleton4.hashCode()+" "+simpleSingleton41.hashCode());

        String json = "Hello,\\r\\nthis is a Windows line.\\r\\nAnd this is another one.\\r\\n";
       // json=json.replaceAll("\\r|\\n", "");
        String correctedText = json.replaceAll("\r\n?|\n", "\n");

         System.out.println(correctedText);
    }
}
